package com.hangzhou.welbeing.welbeinginstrument.factory;

import android.support.v4.app.Fragment;

import com.hangzhou.welbeing.welbeinginstrument.fragement.AffectionAllCircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.CityWideAllCircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.FashionAllCircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.HotsAllCircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.LifeAllCircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.OtherAllCircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.PregnancyAllCircleFragment;
import com.hangzhou.welbeing.welbeinginstrument.fragement.SameAgeAllCircleFragment;

import java.util.HashMap;

/**
 * 时间 2017 年 09 月 09.
 * 作者 Administrator  刘传华
 * 公司 杭州惟君医疗科技有限公司
 * 包名 com.hangzhou.welbeing.pregnant.welbeing_pregnant.factory
 * 工程名 welbeing_pregnant
 */
public class AllCircleFragmentFactory  {
    private  static final int  HOTS = 0;  //热门
    private  static final int  CITY_WIDE = 1;  //同城
    private  static final int  SAME_AGE = 2;   //同龄
    private  static final int  PREGNANCY = 3;   //孕期
    private  static final int  AFFECTION = 4; //情感
    private  static final int  FASHION = 5; //时尚
    private  static final int  lIFE = 6; //生活
    private  static final int  OTHER = 7; //其他
    private static  HashMap<Integer,Fragment> mapAllCircle = new HashMap<Integer,Fragment>();
    public  static Fragment CreateCircleObject(int position){
        Fragment fragment = null;
        fragment = mapAllCircle.get(position);  //在集合中取出来Fragment
        if(fragment == null){
            switch (position){
                case HOTS:
                    fragment = new HotsAllCircleFragment(); //热门
                    break;
                case CITY_WIDE:
                    fragment = new CityWideAllCircleFragment(); //同城
                    break;
                case SAME_AGE:
                    fragment = new SameAgeAllCircleFragment();  //同龄
                    break;
                case PREGNANCY:
                    fragment = new PregnancyAllCircleFragment(); //孕期
                    break;
                case AFFECTION:
                    fragment = new AffectionAllCircleFragment(); //情感
                    break;
                case FASHION:
                    fragment = new FashionAllCircleFragment(); //时尚
                    break;
                case lIFE:
                    fragment = new LifeAllCircleFragment(); //生活
                    break;
                case OTHER:
                   fragment = new OtherAllCircleFragment(); //其他
                break;
            }
            mapAllCircle.put(position,fragment);
            return fragment;
        }
        return fragment;

    }
}
